<template>
	<view>

		<view>
			<uni-forms ref="form" :modelValue="formData" :rules="rules" validate-trigger="bind" err-show-type="undertext">
				<view class="v1">
					<text>昵称</text>
					<uni-forms-item class="n1"  name="headname">
						<uni-easyinput class="n2" type="text" v-model="formData.headname"  />
					</uni-forms-item>
				</view>
				<view class="v2">
					<text>性别</text>
					<uni-forms-item class="n3"  name="sex">
						<uni-easyinput class="n4" type="text" v-model="formData.sex"  />
					</uni-forms-item>
				</view>
				<view class="v1">
					<text>年龄</text>
					<uni-forms-item class="n1"  name="age">
						<uni-easyinput class="n2" type="text" v-model="formData.age"  />
					</uni-forms-item>
				</view>
				<view class="v1">
					<text>学历</text>
					<uni-forms-item class="n1"  name="xueli">
						<uni-easyinput class="n2" type="text" v-model="formData.xueli"  />
					</uni-forms-item>
				</view>
				<view class="v1">
					<text>工作经历</text>
					<uni-forms-item class="n1"  name="word">
						<uni-easyinput class="n2" type="text" v-model="formData.word"  />
					</uni-forms-item>
				</view>
				<view class="v1">
					<text>电话号码</text>
					<uni-forms-item class="n1"  name="phone">
						<uni-easyinput class="n2" type="text" v-model="formData.phone"  />
					</uni-forms-item>
				</view>
						
				<button class="n5" @click="submit('form')">确定</button>
			</uni-forms>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				formData: {
					username:'',
					headname:'',
					sex:'',
					age:'',
					xueli:'',
					word:'',
					phone:''
				},

				rules: {
					
				}
			}
		},
		onLoad() {
			this.jianli()
		},
		methods: {

			submit(form) {
				let user = this.formData
				uni.request({
					url: 'http://localhost:8081/updateUserxinxi?username=' + user.username + 
					'&headname=' + user.headname+
					'&sex=' + user.sex+
					'&age=' + user.age+
					'&xueli=' + user.xueli+
					'&word=' + user.word+
					'&phone=' + user.phone
					,
					method: 'GET',
					/* data: {
						user
					}, */
					success: (res) => {
								
								uni.showToast({
									title: '更新成功'
								})
								location.reload()
							},
					fail() {
						uni.showToast({
							title: '更新失败'
						})
					}
					
				})
			},
			
			async jianli(){
				const name = uni.getStorageSync('token');
				console.log("简历名："+name);
				const res = await this.$myRuquest({
					url:'/jianli?username='+name
				})
				this.formData=res.data

			}
	
		}
	}
</script>

<style lang="scss">
	
	.v1{
		display: flex;//在一行显示
		text{
			width: 80px;
			margin-top:10px ;
			margin-left: 60px;
			margin-right: -20px;
			font-size: 15px;
		}
		.n2{
			margin: 5px;
			width: 220px;
		}
	}
	.v2{
		display: flex;//在一行显示
		text{
			width: 80px;
			margin-top:10px ;
			margin-left: 60px;
			margin-right: -20px;
			font-size: 15px;
		}
		.n4{
			margin: 5px;
			width: 220px;
		}
	}
	
	.n5{
		color: #E88807;
		background-color: #2C405A;
		width: 290px;
		margin-right: 25px;
	}
	
	.na{
		display: flex;//在一行显示
		justify-content:center; //左右间距
		navigator:nth-child(1){
			margin: 20px;
			color: #E88807;
		}
		navigator:nth-child(2){
			margin: 20px;
			color: #E88807;
		}
	}
</style>
